import {withRouter} from 'react-router';
import {Component} from 'refast';
import logic from './logic';
import Grid, {Row, Col} from 'uxcore-grid';
import Table from 'uxcore-table';

import './PageXxls.less';

class PageXxls extends Component {

  constructor(props) {
    super(props, logic);
  }

  componentWillMount() {
    this.dispatch(['searchMessage'], this.state.searchParams);
  }

  onPagerChange(current, pageSize) {
    this.dispatch(['searchMessage'], {page: current - 1, size: pageSize, content: this.state.searchParams.content});
  }

  onSearch(keyword) {
    this.dispatch(['searchMessage'], {page: this.state.searchParams.page, size: this.state.searchParams.size, content: keyword});
  }

  render() {

    return (
      <div className="page-xxls">
        <Grid fluid={true}>
          <Row className="show-grid">
            <Col xs={36} md={24}>
              <div className="col_1" style={{height: 625.31}}>
                <div className="title title_1">历史消息通知列表</div>
                <div className="container">
                  <Table
                    height={590}
                    onPagerChange={(current, pageSize)=> {
                      this.onPagerChange(current, pageSize);
                    }}
                    onSearch={(searchTxt) => {
                      this.onSearch(searchTxt);
                    }}
                    ref="xxlsTable" {...this.state.tableOption} />
                </div>
              </div>
            </Col>
          </Row>
        </Grid>
      </div>
    );
  }

}

export default withRouter(PageXxls);
